<?php
/**
 * Author: DefinitlyEvil
 * Created at: 2020/9/18 3:07
 */

namespace App\Tools;


class RedisHelper
{
    public static function connect() {
        $redis = new \Redis();
        $redis->connect(getenv("REDIS_HOST"), intval(getenv("REDIS_PORT")));
        $pw = getenv("REDIS_PASSWORD");
        if($pw and strlen($pw) > 0) {
            $redis->auth(getenv("REDIS_PASSWORD"));
        }
        return $redis;
    }
}